package com.example.q_kang.hhh.message;

import com.lzy.okgo.model.Response;
import com.sskj.base.BasePresenter;
import com.sskj.base.api.Constant;
import com.sskj.base.base.HttpData;
import com.sskj.base.bean.MessageListBean;
import com.example.q_kang.hhh.api.JsonCallBack;


/**
 * @author Hey
 * Create at  2019/04/15
 */
class MsgDetailPresenter extends BasePresenter<MsgDetailActivity> {

    public void getMsgDetail(String msgId) {
        httpService.getMsgDetail(msgId)
                .tag(this)
                .execute(new JsonCallBack<HttpData<MessageListBean.MessageBean>>() {
                    @Override
                    public void onSuccess(Response<HttpData<MessageListBean.MessageBean>> response) {
                        HttpData<MessageListBean.MessageBean> body = response.body();
                        if (body.getStatus() == Constant.OK) {
                            mView.showMsg(body.getData());
                        }

                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.hideLoading();
                    }
                });
    }
}
